from rest_framework import serializers

from basic_info.models import SupplierModel


class SupplierSerializer(serializers.ModelSerializer):
    """
    供应商信息的序列化器
    """

    class Meta:
        model = SupplierModel
        fields = '__all__'


class SupplierFindSerializer(serializers.ModelSerializer):
    """
    搜索过滤的序列化器
    """
    name = serializers.CharField(required=False, write_only=True)

    class Meta:
        model = SupplierModel
        fields = ['name', 'mobile', 'phone']
